<?php namespace Home\Controller; 

use Hdphp\Controller\Controller;
use Home\Model\Detail;

class DetailController extends Controller
{
	protected $db;

	//构造函数
	public function __init()
	{
		$this->db = new Detail;
	}
	
    //商品显示页
    public function show()
    {
    	$goods_id = Q('get.goods_id');
    	$sql = "SELECT * FROM hd_shop_goods JOIN hd_shop_pics ON goods_id = hd_shop_goods_goods_id WHERE goods_id=$goods_id";
    	$goods = Db::select($sql);
    	$value = Db::table('shop_goods_attr')->join('shop_attr','hd_shop_attr_attr_id','=','attr_id')->where('hd_shop_goods_goods_id',$goods_id)->get();
    	$attr = Db::table('shop_attr')->where('hd_shop_type_id',5)->where('attr_type',1)->get();
    	$goods[0]['attr_value'] = $value;
    	View::with('public',$attr);
    	View::with('goods',$goods);
        View::make();
    }
}
